<?php

namespace app\http\api\controller;

use app\http\api\service\MerchantService;
use Carbon\Carbon;
use DI\Attribute\Inject;
use support\Request;
use support\Response;

class Merchant
{
    #[Inject]
    protected MerchantService $merchantService;

    public function index(Request $request): Response
    {
        $today = Carbon::today();
        $data = [
            'start'   => $request->post('start', 0),
            'length'  => $request->post('length', 10),
            'keyword' => $request->post('keyword'),
            'type'    => $request->post('type'),
        ];
        return json($this->merchantService->getList($data));
    }
}